app.controller("activityRegistCtrl", function($scope,$http) {
	
	var parameters = {};

	//
	$scope.query = function(){
		$scope.paginationConf.currentPage=1;
		var activity = $scope.activity;
		
		parameters = {
			index : $scope.paginationConf.currentPage,
	    	         	pageSize : $scope.paginationConf.itemsPerPage
		};

		if(activity!=undefined){
	    	         	parameters.code = activity.code;
	    	         	parameters.startTime = activity.startTime;
	    	         	parameters.endTime  = activity.endTime;
		}

		 $scope.list(parameters);
	};



    	$scope.list = function(parameters) {
    		console.log(parameters)

	        $http.get("${basePath}/activity/manager/applys.json",parameters)
    		.success(function(response) {
    			$scope.rows = response.rows;
    			$scope.paginationConf.totalItems=response.total;
    			}
    		);
	 };

	 //paging plugin  code
               $scope.paginationConf = {
	            currentPage: 1,
	            totalItems: 0,
	            itemsPerPage: 15,
	            pagesLength: 15,
	            perPageOptions: [10, 20, 30, 40, 50],
	            rememberPerPage: 'perPageItems',
	            onChange: function(){

	            	parameters.index = $scope.paginationConf.currentPage;
    	         	parameters.pageSize = $scope.paginationConf.itemsPerPage;
	            	
	            	$scope.list(parameters);
	            }
               };

               $(".form_datetime").datetimepicker({format: 'yyyy-mm-dd hh:ii'});

});